@redvars/peacock 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseField-BMumJpkW.js → BaseField-_unSNU5x.js} +40 -4
- package/dist/BaseField-_unSNU5x.js.map +1 -0
- package/dist/{BaseInput-mWdyYv27.js → BaseInput-DtZH0fPJ.js} +3 -3
- package/dist/BaseInput-DtZH0fPJ.js.map +1 -0
- package/dist/ai-badge.js +32 -6
- package/dist/ai-badge.js.map +1 -1
- package/dist/ai-summary.js +2 -2
- package/dist/alert.js +2 -2
- package/dist/anchor-nav.js +2 -2
- package/dist/app-shell.js +2 -2
- package/dist/assistant-panel.js +2 -2
- package/dist/assistant-step.js +2 -2
- package/dist/assistant-steps.js +2 -2
- package/dist/avatar-group.js +2 -2
- package/dist/banner.js +2 -2
- package/dist/{base-progress-CvLVSjuy.js → base-progress-D7Nmfh1s.js} +2 -2
- package/dist/{base-progress-CvLVSjuy.js.map → base-progress-D7Nmfh1s.js.map} +1 -1
- package/dist/bottom-sheet.js +2 -2
- package/dist/breadcrumb.js +2 -2
- package/dist/button.js +11 -5
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +2 -2
- package/dist/{canvas-base-BTQMEVn_.js → canvas-base-CWQ4rQ2s.js} +2 -2
- package/dist/{canvas-base-BTQMEVn_.js.map → canvas-base-CWQ4rQ2s.js.map} +1 -1
- package/dist/{cartesian-chart-DM1FC_XT.js → cartesian-chart-CS5yRLfE.js} +2 -2
- package/dist/{cartesian-chart-DM1FC_XT.js.map → cartesian-chart-CS5yRLfE.js.map} +1 -1
- package/dist/{cb-group-base-B6fa4Lll.js → cb-group-base-CO30uFQZ.js} +2 -2
- package/dist/{cb-group-base-B6fa4Lll.js.map → cb-group-base-CO30uFQZ.js.map} +1 -1
- package/dist/cb-group.js +3 -3
- package/dist/cb-rule.js +3 -3
- package/dist/chart-area.js +4 -4
- package/dist/chart-bar.js +4 -4
- package/dist/{chart-base-Dhxuw_Mw.js → chart-base-C_XKVyhf.js} +2 -2
- package/dist/{chart-base-Dhxuw_Mw.js.map → chart-base-C_XKVyhf.js.map} +1 -1
- package/dist/chart-doughnut.js +3 -3
- package/dist/chart-line.js +4 -4
- package/dist/chart-pie.js +3 -3
- package/dist/chat-event.js +152 -0
- package/dist/chat-event.js.map +1 -0
- package/dist/chat-message.js +195 -19
- package/dist/chat-message.js.map +1 -1
- package/dist/chat-thread.js +26 -9
- package/dist/chat-thread.js.map +1 -1
- package/dist/checkbox-group.js +4 -4
- package/dist/checkbox.js +4 -4
- package/dist/chip-set.js +3 -3
- package/dist/chip.js +2 -2
- package/dist/circular-progress.js +3 -3
- package/dist/citation.js +2 -2
- package/dist/code-editor.js +4 -4
- package/dist/code-highlighter.js +2 -2
- package/dist/color-field.js +5 -5
- package/dist/color-picker.js +2 -2
- package/dist/command-palette.js +2 -2
- package/dist/comment-composer.js +5 -5
- package/dist/condition-builder.js +3 -3
- package/dist/confirm-dialog.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/currency-field.js +5 -5
- package/dist/custom-elements-jsdocs.json +174 -20
- package/dist/custom-elements.json +1122 -68
- package/dist/date-field.js +6 -6
- package/dist/date-picker.js +2 -2
- package/dist/date-range-field.js +6 -6
- package/dist/datetime-field.js +6 -6
- package/dist/dependency-map.js +3 -3
- package/dist/description-item.js +2 -2
- package/dist/description-list.js +2 -2
- package/dist/{diagram-2r11KySs.js → diagram-Va096vj9.js} +2 -2
- package/dist/{diagram-2r11KySs.js.map → diagram-Va096vj9.js.map} +1 -1
- package/dist/diagram-controls.js +2 -2
- package/dist/diagram-minimap.js +2 -2
- package/dist/diagram.js +4 -4
- package/dist/diff-viewer.js +2 -2
- package/dist/discussion-activity.js +4 -4
- package/dist/discussion-comment.js +4 -4
- package/dist/{discussion-time-BegaYfhf.js → discussion-time-DqykqvNy.js} +2 -2
- package/dist/{discussion-time-BegaYfhf.js.map → discussion-time-DqykqvNy.js.map} +1 -1
- package/dist/discussion.js +7 -7
- package/dist/{document-editor-BnEugM3E.js → document-editor-Dc8JeFVB.js} +2 -2
- package/dist/{document-editor-BnEugM3E.js.map → document-editor-Dc8JeFVB.js.map} +1 -1
- package/dist/document-editor.js +3 -3
- package/dist/draft-card.js +14 -4
- package/dist/draft-card.js.map +1 -1
- package/dist/dropdown-button.js +3 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/erd.js +3 -3
- package/dist/file-upload.js +4 -4
- package/dist/filter-bar.js +2 -2
- package/dist/flow.js +4 -4
- package/dist/form.js +3 -3
- package/dist/{generative-view-BgOcLRXr.js → generative-view-BKlcuujw.js} +2 -2
- package/dist/{generative-view-BgOcLRXr.js.map → generative-view-BKlcuujw.js.map} +1 -1
- package/dist/generative-view.js +3 -3
- package/dist/html-editor.js +5 -5
- package/dist/{i18n-controller-Cp43HjJl.js → i18n-controller-DJHsE1YH.js} +2 -2
- package/dist/{i18n-controller-Cp43HjJl.js.map → i18n-controller-DJHsE1YH.js.map} +1 -1
- package/dist/icon-button.js +7 -5
- package/dist/icon-button.js.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +21 -20
- package/dist/index.js.map +1 -1
- package/dist/inline-edit.js +2 -2
- package/dist/input.js +4 -4
- package/dist/json-viewer.js +2 -2
- package/dist/kanban.js +2 -2
- package/dist/kbd.js +2 -2
- package/dist/linear-progress.js +3 -3
- package/dist/link-button.js +7 -5
- package/dist/link-button.js.map +1 -1
- package/dist/listbox.js +3 -3
- package/dist/loader-full.js +13 -12
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +16 -12
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +5 -5
- package/dist/mention-input.js +5 -5
- package/dist/{menu-trigger-controller-DyLpTxM7.js → menu-trigger-controller-CEJq1ugC.js} +11 -14
- package/dist/menu-trigger-controller-CEJq1ugC.js.map +1 -0
- package/dist/modal.js +2 -2
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-drawer.js +2 -2
- package/dist/navigation-rail.js +2 -2
- package/dist/notification-center.js +3 -3
- package/dist/number-field.js +5 -5
- package/dist/page-header.js +2 -2
- package/dist/pagination.js +2 -2
- package/dist/password-field.js +5 -5
- package/dist/password-rules.js +2 -2
- package/dist/phone-field.js +5 -5
- package/dist/{picker-field-dTlIMAQn.js → picker-field-CUI05sWc.js} +3 -3
- package/dist/{picker-field-dTlIMAQn.js.map → picker-field-CUI05sWc.js.map} +1 -1
- package/dist/pin-input.js +5 -5
- package/dist/presence-indicator.js +2 -2
- package/dist/prompt-input.js +5 -5
- package/dist/radio-group.js +1 -1
- package/dist/radio.js +4 -4
- package/dist/rating.js +4 -4
- package/dist/redvars-loader.js +2 -2
- package/dist/{relative-time-BVQXLuHm.js → relative-time-BNxqvEbg.js} +13 -2
- package/dist/relative-time-BNxqvEbg.js.map +1 -0
- package/dist/relative-time.js +3 -3
- package/dist/resizable-panels.js +2 -2
- package/dist/{rich-text-input-DM_BOzgk.js → rich-text-input-N_hqnXej.js} +3 -3
- package/dist/{rich-text-input-DM_BOzgk.js.map → rich-text-input-N_hqnXej.js.map} +1 -1
- package/dist/{schema-B8g30A_n.js → schema-Dy0z-80u.js} +2 -2
- package/dist/{schema-B8g30A_n.js.map → schema-Dy0z-80u.js.map} +1 -1
- package/dist/search.js +4 -4
- package/dist/select.js +5 -5
- package/dist/side-sheet.js +2 -2
- package/dist/signature-pad.js +4 -4
- package/dist/slider.js +4 -4
- package/dist/snackbar.js +2 -2
- package/dist/sparkline.js +2 -2
- package/dist/split-button.js +109 -21
- package/dist/split-button.js.map +1 -1
- package/dist/src/__internal/ai/suggestion-controller.d.ts +2 -0
- package/dist/src/__internal/i18n/strings.d.ts +6 -0
- package/dist/src/__internal/menu-trigger-controller.d.ts +11 -8
- package/dist/src/__internal/utils/relative-time.d.ts +5 -0
- package/dist/src/ai-badge/ai-badge.d.ts +8 -0
- package/dist/src/button/button/button.d.ts +4 -0
- package/dist/src/chat-message/chat-message.d.ts +51 -10
- package/dist/src/chat-message/index.d.ts +1 -1
- package/dist/src/chat-thread/chat-event.d.ts +37 -0
- package/dist/src/chat-thread/chat-thread.d.ts +7 -4
- package/dist/src/chat-thread/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/input/BaseField.d.ts +12 -1
- package/dist/src/input/BaseInput.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +7 -2
- package/dist/src/textarea/textarea.d.ts +2 -0
- package/dist/stat.js +2 -2
- package/dist/status-indicator.js +2 -2
- package/dist/step.js +2 -2
- package/dist/stepper.js +2 -2
- package/dist/{strings-BJPuhKJk.js → strings-DnYjGbbc.js} +7 -1
- package/dist/{strings-BJPuhKJk.js.map → strings-DnYjGbbc.js.map} +1 -1
- package/dist/{suggestion-controller-CW17adxd.js → suggestion-controller-7YRQqkaI.js} +3 -1
- package/dist/{suggestion-controller-CW17adxd.js.map → suggestion-controller-7YRQqkaI.js.map} +1 -1
- package/dist/svg.js +2 -2
- package/dist/switch.js +4 -4
- package/dist/table.js +50 -11
- package/dist/table.js.map +1 -1
- package/dist/textarea.js +10 -5
- package/dist/textarea.js.map +1 -1
- package/dist/time-field.js +6 -6
- package/dist/time-picker.js +2 -2
- package/dist/timeline-item.js +2 -2
- package/dist/timeline.js +2 -2
- package/dist/{toggle-base-BlaHalfS.js → toggle-base-CXmFSp3b.js} +2 -2
- package/dist/{toggle-base-BlaHalfS.js.map → toggle-base-CXmFSp3b.js.map} +1 -1
- package/dist/tour.js +2 -2
- package/dist/transfer-list.js +4 -4
- package/dist/tree-chart.js +3 -3
- package/dist/tree-item.js +2 -2
- package/dist/tree.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typing-indicator.js +2 -2
- package/dist/url-field.js +5 -5
- package/dist/user-menu.js +3 -3
- package/dist/virtual-list.js +2 -2
- package/dist/workflow-timeline.js +2 -2
- package/dist/workflow.js +3 -3
- package/dist/workspace-switcher.js +3 -3
- package/package.json +1 -1
- package/src/__internal/ai/suggestion-controller.ts +3 -1
- package/src/__internal/i18n/strings.ts +6 -0
- package/src/__internal/menu-trigger-controller.ts +11 -15
- package/src/__internal/utils/relative-time.ts +20 -0
- package/src/ai-badge/ai-badge.scss +8 -0
- package/src/ai-badge/ai-badge.ts +21 -4
- package/src/button/button/button-base.scss +9 -2
- package/src/button/button/button-layers.scss +3 -1
- package/src/button/button/button.ts +4 -0
- package/src/chat-message/chat-message.scss +72 -0
- package/src/chat-message/chat-message.ts +137 -18
- package/src/chat-message/index.ts +1 -0
- package/src/chat-thread/chat-event.scss +36 -0
- package/src/chat-thread/chat-event.ts +79 -0
- package/src/chat-thread/chat-thread.scss +4 -1
- package/src/chat-thread/chat-thread.ts +22 -6
- package/src/chat-thread/index.ts +1 -0
- package/src/draft-card/draft-card.scss +16 -2
- package/src/dropdown-button/dropdown-button.ts +2 -1
- package/src/index.ts +2 -1
- package/src/input/BaseField.ts +42 -2
- package/src/input/BaseInput.ts +1 -1
- package/src/loader.ts +4 -0
- package/src/split-button/split-button-colors.scss +9 -0
- package/src/split-button/split-button-sizes.scss +32 -5
- package/src/split-button/split-button.scss +61 -8
- package/src/split-button/split-button.ts +15 -8
- package/src/table/table.scss +57 -9
- package/src/table/table.ts +3 -1
- package/src/textarea/textarea.ts +7 -0
- package/dist/BaseField-BMumJpkW.js.map +0 -1
- package/dist/BaseInput-mWdyYv27.js.map +0 -1
- package/dist/menu-trigger-controller-DyLpTxM7.js.map +0 -1
- package/dist/relative-time-BVQXLuHm.js.map +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { _ as __decorate, A, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
|
-
import { p as peacockString } from './strings-
|
|
5
|
-
import { B as BaseInput } from './BaseInput-
|
|
4
|
+
import { p as peacockString } from './strings-DnYjGbbc.js';
|
|
5
|
+
import { B as BaseInput } from './BaseInput-DtZH0fPJ.js';
|
|
6
6
|
|
|
7
|
+
/** Below this width, in pixels, a field's Suggested badge shows just the sparkle. */
|
|
8
|
+
const NARROW_FIELD_WIDTH = 320;
|
|
7
9
|
let fieldCount = 0;
|
|
8
10
|
/**
|
|
9
11
|
* Base class for Peacock's text-like fields (input, textarea, number, URL, select, date/time,
|
|
@@ -47,6 +49,8 @@ class BaseField extends BaseInput {
|
|
|
47
49
|
this.configAria = {};
|
|
48
50
|
// ── State ────────────────────────────────────────────────────────────────
|
|
49
51
|
this.focused = false;
|
|
52
|
+
/** The field is too narrow for the Suggested badge's label; it shows just the sparkle. */
|
|
53
|
+
this.__narrow = false;
|
|
50
54
|
// ── Private fields ───────────────────────────────────────────────────────
|
|
51
55
|
/** Id of the hidden description the inner control points at. */
|
|
52
56
|
this.fieldDescriptionId = `wc-field-description-${(fieldCount += 1)}`;
|
|
@@ -70,7 +74,33 @@ class BaseField extends BaseInput {
|
|
|
70
74
|
this.removeAttribute('tabindex');
|
|
71
75
|
}
|
|
72
76
|
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
super.disconnectedCallback();
|
|
79
|
+
this.__widthObserver?.disconnect();
|
|
80
|
+
this.__widthObserver = undefined;
|
|
81
|
+
}
|
|
82
|
+
updated(changed) {
|
|
83
|
+
super.updated(changed);
|
|
84
|
+
// Only a field showing a suggestion pays for an observer.
|
|
85
|
+
if (this.suggestionVisible && !this.__widthObserver) {
|
|
86
|
+
this.__widthObserver = new ResizeObserver(([entry]) => {
|
|
87
|
+
this.__narrow = entry.contentRect.width < NARROW_FIELD_WIDTH;
|
|
88
|
+
});
|
|
89
|
+
this.__widthObserver.observe(this);
|
|
90
|
+
}
|
|
91
|
+
else if (!this.suggestionVisible && this.__widthObserver) {
|
|
92
|
+
this.__widthObserver.disconnect();
|
|
93
|
+
this.__widthObserver = undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
73
96
|
// ── Protected ────────────────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* Whether the Suggested badge always shows just the sparkle, whatever the width. A textarea
|
|
99
|
+
* sets it: a label beside it would narrow every line of the text.
|
|
100
|
+
*/
|
|
101
|
+
get suggestionBadgeIconOnly() {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
74
104
|
/**
|
|
75
105
|
* The error text the field shows: the consumer's `error-text` while `error` is set, else an
|
|
76
106
|
* error the control found itself, else the validation message once it should show.
|
|
@@ -125,7 +155,10 @@ class BaseField extends BaseInput {
|
|
|
125
155
|
<slot name="start" slot="field-start"></slot>
|
|
126
156
|
${options.start ?? A} ${control}
|
|
127
157
|
<slot name="end" slot="field-end"></slot>
|
|
128
|
-
${this.suggestionBadge({
|
|
158
|
+
${this.suggestionBadge({
|
|
159
|
+
slot: 'field-end',
|
|
160
|
+
iconOnly: this.__narrow || this.suggestionBadgeIconOnly,
|
|
161
|
+
})}
|
|
129
162
|
${this.renderClearButton(options.populated)} ${options.end ?? A}
|
|
130
163
|
</wc-field>
|
|
131
164
|
${description
|
|
@@ -229,6 +262,9 @@ __decorate([
|
|
|
229
262
|
__decorate([
|
|
230
263
|
r()
|
|
231
264
|
], BaseField.prototype, "focused", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
r()
|
|
267
|
+
], BaseField.prototype, "__narrow", void 0);
|
|
232
268
|
|
|
233
269
|
export { BaseField as B };
|
|
234
|
-
//# sourceMappingURL=BaseField-
|
|
270
|
+
//# sourceMappingURL=BaseField-_unSNU5x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseField-_unSNU5x.js","sources":["../../src/input/BaseField.ts"],"sourcesContent":["import { html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport type { Size } from '@/__internal/utils/size.js';\nimport BaseInput from './BaseInput.js';\n\n/** Below this width, in pixels, a field's Suggested badge shows just the sparkle. */\nconst NARROW_FIELD_WIDTH = 320;\n\n/** What a field component passes to `renderField()`. */\nexport interface FieldRenderOptions {\n /** Whether the field has a value; outlined fields float their label when it does. */\n populated: boolean;\n /** Overrides the field's own focus state, for fields whose popup keeps them active. */\n focused?: boolean;\n /** An error the control found itself, such as text that does not parse. */\n controlError?: string;\n /** Extra content before the control (after the `start` slot). */\n start?: unknown;\n /** Extra content after the control (after the `end` slot), such as a picker button. */\n end?: unknown;\n /** Character counter shown in the footer, such as `12/100`; empty or unset for none. */\n textCount?: string;\n}\n\nlet fieldCount = 0;\n\n/**\n * Base class for Peacock's text-like fields (input, textarea, number, URL, select, date/time,\n * color). It adds the props every field shares (label, helper/error/warning text, variant, size,\n * clearable, `start`/`end` slots) and renders the `wc-field` frame.\n *\n * It also makes the inner control accessible across the shadow boundary: `fieldAria()` gives it\n * an accessible name from `label`, `aria-invalid` while an error shows, and `aria-describedby`\n * pointing at a hidden copy of the helper or error text in the same shadow root.\n *\n * Subclasses call `renderField(control, options)` in `render()`, spread `fieldAria()` onto the\n * native control, call `emitValue('input' | 'change')` instead of re-dispatching native events\n * (the field event contract: `CustomEvent<{ value }>`, bubbling and composed), and override\n * `clearValue()` if clearing means more than `value = ''`.\n */\nexport default abstract class BaseField extends BaseInput {\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** Label shown above the field; also the control's accessible name. */\n @property({ type: String }) label = '';\n\n /** Hint shown inside the empty control. */\n @property({ type: String }) placeholder = '';\n\n /** Help text shown below the field. */\n @property({ type: String, attribute: 'helper-text' }) helperText = '';\n\n /** Shows the field in its error state with `error-text`. */\n @property({ type: Boolean }) error = false;\n\n /** Error message shown below the field while `error` is set; replaces the help text. */\n @property({ type: String, attribute: 'error-text' }) errorText = '';\n\n /** Shows the field in its warning state with `warning-text`. */\n @property({ type: Boolean }) warning = false;\n\n /** Warning message shown below the field while `warning` is set; replaces the help text. */\n @property({ type: String, attribute: 'warning-text' }) warningText = '';\n\n /** Visual variant of the field. */\n @property({ type: String }) variant: 'default' | 'filled' | 'outlined' =\n 'default';\n\n /** Height of the field: `sm` (2.5rem, default), `md` (3.5rem) or `lg` (4rem). */\n @property({ type: String, reflect: true }) size: Size = 'sm';\n\n /** Shows a button that clears the value while the field has one. */\n @property({ type: Boolean }) clearable = false;\n\n /** ARIA attributes moved from the host onto the inner control. */\n @property({ type: Object }) configAria: Record<string, string> = {};\n\n // ── State ────────────────────────────────────────────────────────────────\n\n @state() protected focused = false;\n\n /** The field is too narrow for the Suggested badge's label; it shows just the sparkle. */\n @state() private __narrow = false;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** Id of the hidden description the inner control points at. */\n protected readonly fieldDescriptionId = `wc-field-description-${(fieldCount += 1)}`;\n\n /** A `tabindex` set on the host, moved to the inner control. */\n protected controlTabIndex?: string;\n\n /** Watches the field's width while it holds a suggestion, so the badge can shrink. */\n private __widthObserver?: ResizeObserver;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n super.connectedCallback();\n // `aria-*` and `tabindex` set on the host belong to the inner control; move them there.\n for (const attr of Array.from(this.attributes)) {\n if (attr.name.startsWith('aria-')) {\n this.configAria = { ...this.configAria, [attr.name]: attr.value };\n this.removeAttribute(attr.name);\n }\n }\n if (this.hasAttribute('tabindex')) {\n this.controlTabIndex = this.getAttribute('tabindex') ?? undefined;\n this.removeAttribute('tabindex');\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.__widthObserver?.disconnect();\n this.__widthObserver = undefined;\n }\n\n protected override updated(changed: PropertyValues) {\n super.updated(changed);\n // Only a field showing a suggestion pays for an observer.\n if (this.suggestionVisible && !this.__widthObserver) {\n this.__widthObserver = new ResizeObserver(([entry]) => {\n this.__narrow = entry.contentRect.width < NARROW_FIELD_WIDTH;\n });\n this.__widthObserver.observe(this);\n } else if (!this.suggestionVisible && this.__widthObserver) {\n this.__widthObserver.disconnect();\n this.__widthObserver = undefined;\n }\n }\n\n // ── Protected ────────────────────────────────────────────────────────────\n\n /**\n * Whether the Suggested badge always shows just the sparkle, whatever the width. A textarea\n * sets it: a label beside it would narrow every line of the text.\n */\n protected get suggestionBadgeIconOnly(): boolean {\n return false;\n }\n\n /**\n * The error text the field shows: the consumer's `error-text` while `error` is set, else an\n * error the control found itself, else the validation message once it should show.\n */\n protected fieldErrorText(controlError = ''): string {\n if (this.error) return this.errorText;\n return controlError || this.validationText;\n }\n\n /**\n * Attributes for the native control: accessible name, invalid state, description and the\n * host's `tabindex`, plus `configAria`. Spread them onto it with `spread(this.fieldAria())`.\n */\n protected fieldAria(controlError = ''): Record<string, string | undefined> {\n const invalid = this.error || !!this.fieldErrorText(controlError);\n return {\n tabindex: this.controlTabIndex,\n 'aria-label': this.label || undefined,\n 'aria-invalid': invalid ? 'true' : undefined,\n 'aria-describedby': this.fieldDescription(controlError)\n ? this.fieldDescriptionId\n : undefined,\n ...this.configAria,\n };\n }\n\n /** Renders the `wc-field` frame around `control`, plus the hidden description. */\n protected renderField(\n control: unknown,\n options: FieldRenderOptions,\n ): TemplateResult {\n const errorText = this.fieldErrorText(options.controlError);\n const description = this.fieldDescription(options.controlError);\n // While a suggestion shows, its reason takes the helper text's place.\n const helperText = this.suggestionReason || this.helperText;\n return html`\n <wc-field\n label=${this.label}\n size=${this.size}\n variant=${this.variant}\n helper-text=${helperText}\n ?required=${this.required}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?skeleton=${this.skeleton}\n ?error=${this.error || !!errorText}\n error-text=${errorText}\n ?warning=${this.warning}\n warning-text=${this.warningText}\n text-count=${options.textCount ?? ''}\n ?populated=${options.populated}\n ?focused=${options.focused ?? this.focused}\n .host=${this}\n class=\"field\"\n >\n <slot name=\"start\" slot=\"field-start\"></slot>\n ${options.start ?? nothing} ${control}\n <slot name=\"end\" slot=\"field-end\"></slot>\n ${this.suggestionBadge({\n slot: 'field-end',\n iconOnly: this.__narrow || this.suggestionBadgeIconOnly,\n })}\n ${this.renderClearButton(options.populated)} ${options.end ?? nothing}\n </wc-field>\n ${description\n ? html`<span id=${this.fieldDescriptionId} hidden>${description}</span>`\n : nothing}\n `;\n }\n\n /** Dispatches `input` or `change` with the current value: the field event contract. */\n protected emitValue(type: 'input' | 'change') {\n this.dispatchEvent(\n new CustomEvent(type, {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n protected override emitSuggestionValue() {\n this.emitValue('input');\n this.emitValue('change');\n }\n\n /** Clears the value for the clear button. Fields with another empty value override it. */\n protected clearValue() {\n this.value = '';\n this.emitValue('input');\n this.emitValue('change');\n }\n\n /** The counter text for a field with a `maxlength`: `12/100`, or '' when there is no limit. */\n protected characterCount(maxLength: number | null | undefined): string {\n if (typeof maxLength !== 'number' || !Number.isFinite(maxLength)) return '';\n if (maxLength < 0) return '';\n const count = String(this.value ?? '').length;\n return peacockString('characterCount')(count, maxLength);\n }\n\n /** Tracks focus of the inner control; bind it to the control's `focus` and `blur`. */\n protected handleFieldFocus = (event: FocusEvent) => {\n this.focused = event.type === 'focus';\n };\n\n // ── Private ──────────────────────────────────────────────────────────────\n\n /** The text the description carries: the error, else the warning, else the help. */\n private fieldDescription(controlError = ''): string {\n const errorText = this.fieldErrorText(controlError);\n if (errorText) return errorText;\n if (this.warning && this.warningText) return this.warningText;\n if (this.suggestionVisible) {\n return peacockString('aiSuggestedDescription')(this.suggestionReason);\n }\n return this.helperText;\n }\n\n private renderClearButton(populated: boolean) {\n if (!this.clearable || !populated || this.disabled || this.readonly) {\n return nothing;\n }\n return html`<wc-icon-button\n slot=\"field-end\"\n class=\"clear-button\"\n shape=\"round\"\n variant=\"text\"\n size=\"sm\"\n aria-label=${peacockString('clear')}\n @click=${() => {\n this.clearValue();\n this.focus();\n }}\n >\n <wc-icon name=\"close\"></wc-icon>\n </wc-icon-button>`;\n }\n}\n"],"names":["html","nothing","property","state"],"mappings":";;;;;;AAOA;AACA,MAAM,kBAAkB,GAAG,GAAG;AAkB9B,IAAI,UAAU,GAAG,CAAC;AAElB;;;;;;;;;;;;;AAaG;AACW,MAAgB,SAAU,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MAAM,EAAE;AAA0C,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAIjD,UAAA,CAAA;AAAlB,IAAAC,CAAK;AAA6B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAGlB,UAAA,CAAA;AAAhB,IAAAA,CAAK;AAA4B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
|
|
@@ -3,8 +3,8 @@ import { n } from './property-B2TG3KEE.js';
|
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { m as mixinElementInternals, i as internals } from './element-internals-QME0yEz4.js';
|
|
5
5
|
import { m as mixinFormAssociated, g as getFormValue } from './form-associated-BHbg72PG.js';
|
|
6
|
-
import { p as peacockString } from './strings-
|
|
7
|
-
import { S as SuggestionController } from './suggestion-controller-
|
|
6
|
+
import { p as peacockString } from './strings-DnYjGbbc.js';
|
|
7
|
+
import { S as SuggestionController } from './suggestion-controller-7YRQqkaI.js';
|
|
8
8
|
|
|
9
9
|
const VALIDITY_KEYS = [
|
|
10
10
|
'valueMissing',
|
|
@@ -298,4 +298,4 @@ __decorate([
|
|
|
298
298
|
], BaseInput.prototype, "showValidity", void 0);
|
|
299
299
|
|
|
300
300
|
export { BaseInput as B, nativeValidity as n };
|
|
301
|
-
//# sourceMappingURL=BaseInput-
|
|
301
|
+
//# sourceMappingURL=BaseInput-DtZH0fPJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInput-DtZH0fPJ.js","sources":["../../src/input/BaseInput.ts"],"sourcesContent":["import { html, LitElement, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport {\n internals,\n mixinElementInternals,\n} from '@/__internal/mixins/element-internals.js';\nimport {\n type FormRestoreState,\n type FormValue,\n getFormValue,\n mixinFormAssociated,\n} from '@/__internal/mixins/form-associated.js';\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport {\n SuggestionController,\n type SuggestionAcceptCause,\n} from '@/__internal/ai/suggestion-controller.js';\nimport type { AiSuggestion } from '@/__internal/ai/types.js';\n\nconst VALIDITY_KEYS = [\n 'valueMissing',\n 'typeMismatch',\n 'patternMismatch',\n 'tooLong',\n 'tooShort',\n 'rangeUnderflow',\n 'rangeOverflow',\n 'stepMismatch',\n 'badInput',\n] as const;\n\n/** The flags `ElementInternals.setValidity()` takes, as the DOM's `ValidityStateFlags`. */\nexport type ValidityFlags = {\n [Key in (typeof VALIDITY_KEYS)[number] | 'customError']?: boolean;\n};\n\n/** What a control reports to `ElementInternals.setValidity()`. */\nexport interface ControlValidity {\n flags: ValidityFlags;\n message: string;\n /** Element the browser points at when it reports the problem; defaults to the host. */\n anchor?: HTMLElement;\n}\n\n/** The validity of a native control, for controls that wrap one. */\nexport function nativeValidity(\n control: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement,\n): ControlValidity {\n const flags: ValidityFlags = {};\n for (const key of VALIDITY_KEYS) {\n if (control.validity[key]) flags[key] = true;\n }\n return { flags, message: control.validationMessage, anchor: control };\n}\n\n/** Set while one `invalid` event per form submission moves focus, so only the first one does. */\nlet focusClaimed = false;\n\n/**\n * Base class for Peacock's form controls.\n *\n * It is form-associated: `value` is submitted with the surrounding `<form>`, `form.reset()`\n * restores the value the control started with, and a disabled `<fieldset>` disables it.\n * `name` and `disabled` come from `mixinFormAssociated`; they are backed by attributes, so\n * subclasses must not redeclare them.\n *\n * It takes part in constraint validation like a native control: `required` and the control's own\n * rules (from `computeValidity()`) block form submission, `checkValidity()`, `reportValidity()`,\n * `setCustomValidity()`, `validity` and `validationMessage` work as on `<input>`, and `:invalid`\n * matches. A control shows its message (`validationText`) once the person has committed a value\n * or the form was submitted.\n *\n * It can hold a value the assistant suggested (ADR-030002): `suggestion` fills the control and\n * marks it until the person accepts or clears it. `sensitive` keeps the control out of AI\n * altogether. Subclasses show the marker with `suggestionBadge()` and `suggestionReason`, and\n * override `readSuggestionValue()`, `writeSuggestionValue()` and `emitSuggestionValue()` when\n * their value is not `value` with `input`/`change` events.\n *\n * @fires {CustomEvent<SuggestionAcceptDetail>} accept - Fired when a suggested value is accepted: the person edited it (`cause: 'edit'`), the form was submitted (`'submit'`) or `acceptSuggestion()` was called (`'action'`).\n * @fires {CustomEvent<SuggestionDismissDetail>} dismiss - Fired when the person clears a suggestion, before `input` and `change` with the restored value.\n */\nexport default abstract class BaseInput extends mixinFormAssociated(\n mixinElementInternals(LitElement),\n) {\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** Each control declares its own `value` (a property, or an accessor such as Switch's). */\n abstract value?: any;\n\n /** Shows the value but stops the user changing it; unlike `disabled`, it stays focusable and is submitted. */\n @property({ type: Boolean, reflect: true })\n readonly: boolean = false;\n\n /** Requires a value before the form can submit. */\n @property({ type: Boolean, reflect: true })\n required: boolean = false;\n\n /** Shows a loading placeholder in place of the control. */\n @property({ type: Boolean, reflect: true })\n skeleton = false;\n\n /**\n * Holds data that must never reach a model, such as a salary or a bank account: the control\n * takes no suggestions and offers no AI features.\n */\n @property({ type: Boolean, reflect: true })\n sensitive = false;\n\n /**\n * A value the assistant suggests, with why. The control takes the value and shows a Suggested\n * badge and the reason until the person edits it, the form is submitted, or the badge clears it,\n * which puts the previous value back. `null` drops the marker and keeps the value. Ignored while\n * AI is off and on `sensitive` controls.\n */\n @property({ attribute: false })\n get suggestion(): AiSuggestion | null {\n return this.__suggestions.suggestion;\n }\n\n set suggestion(suggestion: AiSuggestion | null) {\n const old = this.__suggestions.suggestion;\n this.__suggestions.set(suggestion);\n this.requestUpdate('suggestion', old);\n }\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** Whether to show the validation message: after a commit, or after a failed submit. */\n @state() protected showValidity = false;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** The value the control had when it was first connected; `form.reset()` returns to it. */\n private __defaultValue: unknown = undefined;\n\n private __defaultValueCaptured = false;\n\n private __customValidity = '';\n\n private readonly __suggestions = new SuggestionController(this, {\n read: () => this.readSuggestionValue(),\n write: value => this.writeSuggestionValue(value),\n emit: () => this.emitSuggestionValue(),\n });\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n constructor() {\n super();\n this.addEventListener('invalid', this.__handleInvalid);\n // Every control fires `change` when the person commits a value; from then on, show problems.\n this.addEventListener('change', this.__handleCommit);\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (!this.__defaultValueCaptured) {\n this.__defaultValue = this.value;\n this.__defaultValueCaptured = true;\n }\n }\n\n protected override updated(changed: PropertyValues) {\n super.updated(changed);\n // After render, so a control's inner native input reflects the new value and attributes.\n this.updateValidity();\n }\n\n // ── Public: constraint validation ────────────────────────────────────────\n\n get validity(): ValidityState {\n this.updateValidity();\n return this[internals].validity;\n }\n\n get validationMessage(): string {\n this.updateValidity();\n return this[internals].validationMessage;\n }\n\n get willValidate(): boolean {\n return this[internals].willValidate;\n }\n\n checkValidity(): boolean {\n this.updateValidity();\n return this[internals].checkValidity();\n }\n\n reportValidity(): boolean {\n this.updateValidity();\n return this[internals].reportValidity();\n }\n\n /** Sets a custom error message, as on `<input>`; an empty string clears it. */\n setCustomValidity(message: string): void {\n this.__customValidity = message;\n this.updateValidity();\n this.requestUpdate();\n }\n\n // ── Public: suggestions ──────────────────────────────────────────────────\n\n /** Whether the control holds a suggestion the person hasn't accepted or cleared. */\n get suggested(): boolean {\n return !!this.__suggestions.suggestion;\n }\n\n /** Accepts the suggestion: the value stays and the marker goes. Fires `accept`. */\n acceptSuggestion(cause: SuggestionAcceptCause = 'action'): void {\n this.__suggestions.accept(cause);\n }\n\n /** Clears the suggestion and puts the previous value back. Fires `dismiss`, `input` and `change`. */\n dismissSuggestion(): void {\n this.__suggestions.dismiss();\n }\n\n // ── Protected ────────────────────────────────────────────────────────────\n\n /**\n * The Suggested badge with its clear button, while a suggestion shows; else nothing. Controls\n * without helper text pass `withReason` so the badge's tooltip carries the reason.\n */\n protected suggestionBadge(\n options: { slot?: string; withReason?: boolean; iconOnly?: boolean } = {},\n ) {\n return this.__suggestions.badge(options);\n }\n\n /**\n * A group's label with the Suggested badge beside it while a suggestion shows. The badge stays\n * outside the label element, so it is not part of the group's accessible name. Style\n * `.label-row` as a row.\n */\n protected labelWithSuggestion(label: unknown) {\n if (!this.suggestionVisible) return label;\n return html`<div class=\"label-row\">${label}${this.suggestionBadge()}</div>`;\n }\n\n /** Why the value was suggested, while the suggestion shows; else `''`. */\n protected get suggestionReason(): string {\n return this.__suggestions.reason;\n }\n\n /** Whether a suggestion shows as one now (AI on, not sensitive). */\n protected get suggestionVisible(): boolean {\n return this.__suggestions.visible;\n }\n\n /** The value a suggestion replaces and a dismissed one restores. */\n protected readSuggestionValue(): unknown {\n return this.value;\n }\n\n /** Puts a suggested or restored value into the control. */\n protected writeSuggestionValue(value: unknown): void {\n this.value = value;\n }\n\n /** Fires `input` and `change` after the person cleared a suggestion. */\n protected emitSuggestionValue(): void {\n for (const type of ['input', 'change']) {\n this.dispatchEvent(\n new CustomEvent(type, {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n }\n\n /**\n * The control's own validity. The default checks `required` against an empty `value`;\n * controls that wrap a native input return `nativeValidity(input)`, others add their rules.\n */\n protected computeValidity(): ControlValidity {\n const empty =\n this.value === undefined || this.value === null || this.value === '';\n if (this.required && empty && !this.disabled) {\n return {\n flags: { valueMissing: true },\n message: this.valueMissingText(),\n };\n }\n return { flags: {}, message: '' };\n }\n\n /** The message for a missing required value. */\n protected valueMissingText(): string {\n return peacockString('valueMissing');\n }\n\n /** Pushes the current validity to `ElementInternals`. */\n protected updateValidity(): void {\n if (this.__customValidity) {\n this[internals].setValidity(\n { customError: true },\n this.__customValidity,\n this.validityAnchor(),\n );\n return;\n }\n const { flags, message, anchor } = this.computeValidity();\n const invalid = Object.values(flags).some(Boolean);\n if (invalid) {\n this[internals].setValidity(\n flags,\n message || ' ',\n anchor ?? this.validityAnchor(),\n );\n } else {\n this[internals].setValidity({});\n }\n }\n\n /** The element the browser points at when it reports a problem. */\n protected validityAnchor(): HTMLElement | undefined {\n return undefined;\n }\n\n /** The message to show under the control, or '' while there is nothing to show. */\n protected get validationText(): string {\n if (!this.showValidity) return '';\n this.updateValidity();\n return this[internals].validity.valid\n ? ''\n : this[internals].validationMessage;\n }\n\n // ── Form association ─────────────────────────────────────────────────────\n\n override [getFormValue](): FormValue | null {\n if (this.value === undefined || this.value === null) return null;\n return String(this.value);\n }\n\n formResetCallback() {\n this.__suggestions.set(null);\n this.value = this.__defaultValue;\n this.showValidity = false;\n }\n\n formStateRestoreCallback(restored: FormRestoreState | null) {\n this.value =\n restored === null\n ? this.__defaultValue\n : this.parseRestoreState(restored);\n }\n\n /** Turns saved form state back into a value. Strings by default. */\n protected parseRestoreState(restored: FormRestoreState): unknown {\n return typeof restored === 'string' ? restored : this.__defaultValue;\n }\n\n // ── Private ──────────────────────────────────────────────────────────────\n\n private __handleInvalid = (event: Event) => {\n // Show the message under the control instead of the browser bubble, and move focus to the\n // first invalid control of the submission.\n event.preventDefault();\n this.showValidity = true;\n if (!focusClaimed) {\n focusClaimed = true;\n this.focus();\n queueMicrotask(() => {\n focusClaimed = false;\n });\n }\n };\n\n private __handleCommit = (event: Event) => {\n if (event.target === this) this.showValidity = true;\n };\n}\n"],"names":["LitElement","html","property","state"],"mappings":";;;;;;;;AAoBA,MAAM,aAAa,GAAG;IACpB,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,UAAU;CACF;AAeV;AACM,SAAU,cAAc,CAC5B,OAAmE,EAAA;IAEnE,MAAM,KAAK,GAAkB,EAAE;AAC/B,IAAA,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;AAC/B,QAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;AAAE,YAAA,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAC9C;A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AC,iBAAiB,CAAC,QAAQ,CAAC;IACxC;;AAGU,IAAA,iBAAiB,CAAC,QAA0B,EAAA;AACpD,QAAA,OAAO,OAAO,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc;IACtE;AAqBD;AA5RC,UAAA,CAAA;IADCC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAI1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAI1B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACzB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAOjB,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AACxB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AASlB,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AAG7B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,YAAA,EAAA,IAAA,CAAA;AAWkB,UAAA,CAAA;AAAlB,IAAAC,CAAK;AAAkC,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/ai-badge.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { A as AiController } from './ai-controller-DR_Tg0sN.js';
|
|
4
4
|
import { s as sparkle } from './sparkle-BmtM0vbq.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './locale-DEsJZCQG.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
|
|
9
9
|
var css_248z = i`* {
|
|
10
10
|
box-sizing: border-box;
|
|
@@ -89,6 +89,14 @@ var css_248z = i`* {
|
|
|
89
89
|
padding-inline-end: var(--spacing-025, 0.125rem);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
:host([icon-only]) .badge {
|
|
93
|
+
padding-inline-start: var(--spacing-050, 0.25rem);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([icon-only]:not([dismissible])) .badge {
|
|
97
|
+
padding-inline-end: var(--spacing-050, 0.25rem);
|
|
98
|
+
}
|
|
99
|
+
|
|
92
100
|
.label {
|
|
93
101
|
display: inline-flex;
|
|
94
102
|
align-items: center;
|
|
@@ -163,6 +171,9 @@ var css_248z = i`* {
|
|
|
163
171
|
* and is read as the badge's description. <code>dismissible</code> adds a clear button that fires
|
|
164
172
|
* <code>dismiss</code>; the app then removes the suggestion, discards the draft or hides the
|
|
165
173
|
* summary.</p>
|
|
174
|
+
* <p><code>icon-only</code> keeps just the sparkle where there is no room for the label, such as a
|
|
175
|
+
* narrow field: the label is still read and shows in the tooltip. Fields switch to it on their
|
|
176
|
+
* own when they are narrow.</p>
|
|
166
177
|
* <p>When AI is off for the page (<code>setPeacockAi({ enabled: false })</code>) the badge renders
|
|
167
178
|
* nothing, so a page that still passes AI state in never shows a stale marker.</p>
|
|
168
179
|
* <p>The label is always text, never only the color or the sparkle. Replace it with the default
|
|
@@ -200,6 +211,11 @@ let AiBadge = class AiBadge extends i$1 {
|
|
|
200
211
|
this.reason = '';
|
|
201
212
|
/** Adds a button that clears the output in one action. */
|
|
202
213
|
this.dismissible = false;
|
|
214
|
+
/**
|
|
215
|
+
* Shows only the sparkle, for tight spaces such as a narrow field. The label stays the
|
|
216
|
+
* accessible name and shows in the tooltip.
|
|
217
|
+
*/
|
|
218
|
+
this.iconOnly = false;
|
|
203
219
|
// ── Private fields ───────────────────────────────────────────────────────
|
|
204
220
|
this._ai = new AiController(this);
|
|
205
221
|
this.i18n = new I18nController(this);
|
|
@@ -228,10 +244,17 @@ let AiBadge = class AiBadge extends i$1 {
|
|
|
228
244
|
if (!this._ai.available)
|
|
229
245
|
return A;
|
|
230
246
|
const reason = this.reason.trim();
|
|
247
|
+
const { iconOnly } = this;
|
|
248
|
+
// Icon-only, the tooltip says what the sparkle stands for, then why.
|
|
249
|
+
const tooltip = iconOnly
|
|
250
|
+
? [this._label(), reason].filter(Boolean).join('. ')
|
|
251
|
+
: reason;
|
|
231
252
|
// The tooltip sits outside the badge so it doesn't inherit the badge's one-line label styles.
|
|
232
253
|
return b `<span class="badge" part="badge"
|
|
233
|
-
><span class="label" id="label" tabindex=${
|
|
234
|
-
>${sparkle}<
|
|
254
|
+
><span class="label" id="label" tabindex=${tooltip ? 0 : A}
|
|
255
|
+
>${sparkle}<span class=${iconOnly ? 'screen-reader-only' : 'text'}
|
|
256
|
+
><slot>${this._label()}</slot></span
|
|
257
|
+
></span
|
|
235
258
|
>${this.dismissible
|
|
236
259
|
? b `<button
|
|
237
260
|
class="dismiss"
|
|
@@ -243,9 +266,9 @@ let AiBadge = class AiBadge extends i$1 {
|
|
|
243
266
|
<wc-icon name="close"></wc-icon>
|
|
244
267
|
</button>`
|
|
245
268
|
: A}</span
|
|
246
|
-
>${
|
|
269
|
+
>${tooltip
|
|
247
270
|
? b `<wc-tooltip for="label" placement="bottom-start"
|
|
248
|
-
>${
|
|
271
|
+
>${tooltip}</wc-tooltip
|
|
249
272
|
>`
|
|
250
273
|
: A}`;
|
|
251
274
|
}
|
|
@@ -260,6 +283,9 @@ __decorate([
|
|
|
260
283
|
__decorate([
|
|
261
284
|
n({ type: Boolean, reflect: true })
|
|
262
285
|
], AiBadge.prototype, "dismissible", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
n({ type: Boolean, reflect: true, attribute: 'icon-only' })
|
|
288
|
+
], AiBadge.prototype, "iconOnly", void 0);
|
|
263
289
|
__decorate([
|
|
264
290
|
n({ attribute: false })
|
|
265
291
|
], AiBadge.prototype, "strings", void 0);
|
package/dist/ai-badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-badge.js","sources":["../../src/ai-badge/ai-badge.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { AiController } from '@/__internal/ai/ai-controller.js';\nimport { sparkle } from '@/__internal/ai/sparkle.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport type { PeacockStrings } from '@/__internal/i18n/strings.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './ai-badge.scss';\n\n/** What the marked output is. */\nexport type AiBadgeKind = 'suggested' | 'draft' | 'generated';\n\n/**\n * @label AI Badge\n * @tag wc-ai-badge\n * @rawTag ai-badge\n * @summary Marks a value, draft or text as made by the assistant, says why, and can clear it in one action.\n * @overview\n * <p>The one marker for AI output in Peacock (ADR-030002). Put it beside anything the assistant\n * made until a person accepts it:</p>\n * <ul>\n * <li><code>suggested</code> (default): a value the person hasn't accepted, such as a field the\n * assistant filled in.</li>\n * <li><code>draft</code>: a record or text waiting to be confirmed, such as an incident the\n * assistant prepared.</li>\n * <li><code>generated</code>: read-only output, such as a summary. Shown as colored text without\n * a container.</li>\n * </ul>\n * <p><code>reason</code> says why, in a sentence: it shows in a tooltip on hover or keyboard focus\n * and is read as the badge's description. <code>dismissible</code> adds a clear button that fires\n * <code>dismiss</code>; the app then removes the suggestion, discards the draft or hides the\n * summary.</p>\n * <p>When AI is off for the page (<code>setPeacockAi({ enabled: false })</code>) the badge renders\n * nothing, so a page that still passes AI state in never shows a stale marker.</p>\n * <p>The label is always text, never only the color or the sparkle. Replace it with the default\n * slot, for example \"Summary by the assistant\".</p>\n * @tags display, ai\n *\n * @slot - The label, instead of the default one for the kind.\n *\n * @csspart badge - The badge container.\n * @csspart sparkle - The sparkle glyph.\n * @csspart dismiss - The clear button.\n *\n * @cssprop --ai-badge-container-color - Background of the badge.\n * @cssprop --ai-badge-color - Text and sparkle color.\n *\n * @fires {CustomEvent<void>} dismiss - Fired when the clear button is pressed.\n *\n * @example\n * ```html\n * <wc-ai-badge reason=\"You didn't say you can't work.\"></wc-ai-badge>\n * ```\n * @example\n * ```html\n * <wc-ai-badge kind=\"generated\">Summary by the assistant</wc-ai-badge>\n * ```\n */\n@IndividualComponent\nexport class AiBadge extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** What the marked output is: `suggested`, `draft` or `generated`. */\n @property({ type: String, reflect: true }) kind: AiBadgeKind = 'suggested';\n\n /** Why the assistant made this, in a sentence. Shown in a tooltip and read as the description. */\n @property({ type: String }) reason = '';\n\n /** Adds a button that clears the output in one action. */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n /** Per-instance string overrides. */\n @property({ attribute: false }) strings?: Partial<PeacockStrings>;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n private readonly _ai = new AiController(this);\n\n private readonly i18n = new I18nController(this);\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private _label(): string {\n if (this.kind === 'draft') return this.i18n.t('aiDraft');\n if (this.kind === 'generated') return this.i18n.t('aiGenerated');\n return this.i18n.t('aiSuggested');\n }\n\n private _dismissLabel(): string {\n if (this.kind === 'draft') return this.i18n.t('aiDiscardDraft');\n if (this.kind === 'generated') return this.i18n.t('aiHideGenerated');\n return this.i18n.t('aiClearSuggestion');\n }\n\n private _onDismiss(event: Event) {\n event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent('dismiss', { bubbles: true, composed: true }),\n );\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n if (!this._ai.available) return nothing;\n const reason = this.reason.trim();\n // The tooltip sits outside the badge so it doesn't inherit the badge's one-line label styles.\n return html`<span class=\"badge\" part=\"badge\"\n ><span class=\"label\" id=\"label\" tabindex=${
|
|
1
|
+
{"version":3,"file":"ai-badge.js","sources":["../../src/ai-badge/ai-badge.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { AiController } from '@/__internal/ai/ai-controller.js';\nimport { sparkle } from '@/__internal/ai/sparkle.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport type { PeacockStrings } from '@/__internal/i18n/strings.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './ai-badge.scss';\n\n/** What the marked output is. */\nexport type AiBadgeKind = 'suggested' | 'draft' | 'generated';\n\n/**\n * @label AI Badge\n * @tag wc-ai-badge\n * @rawTag ai-badge\n * @summary Marks a value, draft or text as made by the assistant, says why, and can clear it in one action.\n * @overview\n * <p>The one marker for AI output in Peacock (ADR-030002). Put it beside anything the assistant\n * made until a person accepts it:</p>\n * <ul>\n * <li><code>suggested</code> (default): a value the person hasn't accepted, such as a field the\n * assistant filled in.</li>\n * <li><code>draft</code>: a record or text waiting to be confirmed, such as an incident the\n * assistant prepared.</li>\n * <li><code>generated</code>: read-only output, such as a summary. Shown as colored text without\n * a container.</li>\n * </ul>\n * <p><code>reason</code> says why, in a sentence: it shows in a tooltip on hover or keyboard focus\n * and is read as the badge's description. <code>dismissible</code> adds a clear button that fires\n * <code>dismiss</code>; the app then removes the suggestion, discards the draft or hides the\n * summary.</p>\n * <p><code>icon-only</code> keeps just the sparkle where there is no room for the label, such as a\n * narrow field: the label is still read and shows in the tooltip. Fields switch to it on their\n * own when they are narrow.</p>\n * <p>When AI is off for the page (<code>setPeacockAi({ enabled: false })</code>) the badge renders\n * nothing, so a page that still passes AI state in never shows a stale marker.</p>\n * <p>The label is always text, never only the color or the sparkle. Replace it with the default\n * slot, for example \"Summary by the assistant\".</p>\n * @tags display, ai\n *\n * @slot - The label, instead of the default one for the kind.\n *\n * @csspart badge - The badge container.\n * @csspart sparkle - The sparkle glyph.\n * @csspart dismiss - The clear button.\n *\n * @cssprop --ai-badge-container-color - Background of the badge.\n * @cssprop --ai-badge-color - Text and sparkle color.\n *\n * @fires {CustomEvent<void>} dismiss - Fired when the clear button is pressed.\n *\n * @example\n * ```html\n * <wc-ai-badge reason=\"You didn't say you can't work.\"></wc-ai-badge>\n * ```\n * @example\n * ```html\n * <wc-ai-badge kind=\"generated\">Summary by the assistant</wc-ai-badge>\n * ```\n */\n@IndividualComponent\nexport class AiBadge extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** What the marked output is: `suggested`, `draft` or `generated`. */\n @property({ type: String, reflect: true }) kind: AiBadgeKind = 'suggested';\n\n /** Why the assistant made this, in a sentence. Shown in a tooltip and read as the description. */\n @property({ type: String }) reason = '';\n\n /** Adds a button that clears the output in one action. */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n /**\n * Shows only the sparkle, for tight spaces such as a narrow field. The label stays the\n * accessible name and shows in the tooltip.\n */\n @property({ type: Boolean, reflect: true, attribute: 'icon-only' })\n iconOnly = false;\n\n /** Per-instance string overrides. */\n @property({ attribute: false }) strings?: Partial<PeacockStrings>;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n private readonly _ai = new AiController(this);\n\n private readonly i18n = new I18nController(this);\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private _label(): string {\n if (this.kind === 'draft') return this.i18n.t('aiDraft');\n if (this.kind === 'generated') return this.i18n.t('aiGenerated');\n return this.i18n.t('aiSuggested');\n }\n\n private _dismissLabel(): string {\n if (this.kind === 'draft') return this.i18n.t('aiDiscardDraft');\n if (this.kind === 'generated') return this.i18n.t('aiHideGenerated');\n return this.i18n.t('aiClearSuggestion');\n }\n\n private _onDismiss(event: Event) {\n event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent('dismiss', { bubbles: true, composed: true }),\n );\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n if (!this._ai.available) return nothing;\n const reason = this.reason.trim();\n const { iconOnly } = this;\n // Icon-only, the tooltip says what the sparkle stands for, then why.\n const tooltip = iconOnly\n ? [this._label(), reason].filter(Boolean).join('. ')\n : reason;\n // The tooltip sits outside the badge so it doesn't inherit the badge's one-line label styles.\n return html`<span class=\"badge\" part=\"badge\"\n ><span class=\"label\" id=\"label\" tabindex=${tooltip ? 0 : nothing}\n >${sparkle}<span class=${iconOnly ? 'screen-reader-only' : 'text'}\n ><slot>${this._label()}</slot></span\n ></span\n >${this.dismissible\n ? html`<button\n class=\"dismiss\"\n part=\"dismiss\"\n type=\"button\"\n aria-label=${this._dismissLabel()}\n @click=${this._onDismiss}\n >\n <wc-icon name=\"close\"></wc-icon>\n </button>`\n : nothing}</span\n >${tooltip\n ? html`<wc-tooltip for=\"label\" placement=\"bottom-start\"\n >${tooltip}</wc-tooltip\n >`\n : nothing}`;\n }\n}\n"],"names":["LitElement","nothing","html","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQA,GAAU,CAAA;AAAhC,IAAA,WAAA,GAAA;;;;;QAQsC,IAAA,CAAA,IAAI,GAAgB,WAAW;;QAG9C,IAAA,CAAA,MAAM,GAAG,EAAE;;QAGK,IAAA,CAAA,WAAW,GAAG,KAAK;AAE/D;;;AAGG;QAEH,IAAA,CAAA,QAAQ,GA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AAA,EAAA,MAAA,CAAA;AAGe,UAAA,CAAA;AAA/B,IAAAA,CAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AAAoC,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAxBvD,OAAO,GAAA,UAAA,CAAA;IADnB;AACY,CAAA,EAAA,OAAO,CAsFnB;;;;"}
|
package/dist/ai-summary.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, b, A } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { A as AiController } from './ai-controller-DR_Tg0sN.js';
|
|
4
4
|
import { s as sparkle } from './sparkle-BmtM0vbq.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './locale-DEsJZCQG.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
|
|
9
9
|
var css_248z = i`* {
|
|
10
10
|
box-sizing: border-box;
|
package/dist/alert.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './class-map-NDIkZErE.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './directive-ZPhl09Yt.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
import './locale-DEsJZCQG.js';
|
|
9
9
|
|
|
10
10
|
var css_248z = i`* {
|
package/dist/anchor-nav.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './class-map-NDIkZErE.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './directive-ZPhl09Yt.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
import './locale-DEsJZCQG.js';
|
|
9
9
|
|
|
10
10
|
var css_248z = i`* {
|
package/dist/app-shell.js
CHANGED
|
@@ -3,11 +3,11 @@ import { n } from './property-B2TG3KEE.js';
|
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
5
|
import { e as e$1 } from './class-map-NDIkZErE.js';
|
|
6
|
-
import { I as I18nController } from './i18n-controller-
|
|
6
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
7
7
|
import { O as OverlayController } from './overlay-controller-BOk-kfil.js';
|
|
8
8
|
import './base-Cl6v8-BZ.js';
|
|
9
9
|
import './directive-ZPhl09Yt.js';
|
|
10
|
-
import './strings-
|
|
10
|
+
import './strings-DnYjGbbc.js';
|
|
11
11
|
import './locale-DEsJZCQG.js';
|
|
12
12
|
|
|
13
13
|
var css_248z = i`* {
|
package/dist/assistant-panel.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { A as AiController } from './ai-controller-DR_Tg0sN.js';
|
|
4
4
|
import { s as sparkle } from './sparkle-BmtM0vbq.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './locale-DEsJZCQG.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
|
|
9
9
|
var css_248z = i`* {
|
|
10
10
|
box-sizing: border-box;
|
package/dist/assistant-step.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
|
-
import { I as I18nController } from './i18n-controller-
|
|
4
|
-
import './strings-
|
|
3
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
4
|
+
import './strings-DnYjGbbc.js';
|
|
5
5
|
import './locale-DEsJZCQG.js';
|
|
6
6
|
|
|
7
7
|
var css_248z = i`* {
|
package/dist/assistant-steps.js
CHANGED
|
@@ -2,10 +2,10 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { A as AiController } from './ai-controller-DR_Tg0sN.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import { STEP_STATUS } from './assistant-step.js';
|
|
7
7
|
import './locale-DEsJZCQG.js';
|
|
8
|
-
import './strings-
|
|
8
|
+
import './strings-DnYjGbbc.js';
|
|
9
9
|
|
|
10
10
|
var css_248z = i`* {
|
|
11
11
|
box-sizing: border-box;
|
package/dist/avatar-group.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, a as i$1, _ as __decorate, I as IndividualComponent, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './base-Cl6v8-BZ.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
import './locale-DEsJZCQG.js';
|
|
9
9
|
|
|
10
10
|
var css_248z = i`* {
|
package/dist/banner.js
CHANGED
|
@@ -2,9 +2,9 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './class-map-NDIkZErE.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
6
6
|
import './directive-ZPhl09Yt.js';
|
|
7
|
-
import './strings-
|
|
7
|
+
import './strings-DnYjGbbc.js';
|
|
8
8
|
import './locale-DEsJZCQG.js';
|
|
9
9
|
|
|
10
10
|
var css_248z = i`* {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as i, _ as __decorate } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
|
-
import { I as I18nController } from './i18n-controller-
|
|
3
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
4
4
|
import { m as mixinDelegatesAria } from './delegate-Bw2wdPFP.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -59,4 +59,4 @@ __decorate([
|
|
|
59
59
|
], BaseProgress.prototype, "inline", void 0);
|
|
60
60
|
|
|
61
61
|
export { BaseProgress as B };
|
|
62
|
-
//# sourceMappingURL=base-progress-
|
|
62
|
+
//# sourceMappingURL=base-progress-D7Nmfh1s.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-progress-
|
|
1
|
+
{"version":3,"file":"base-progress-D7Nmfh1s.js","sources":["../../src/progress/base-progress.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport { mixinDelegatesAria } from '@/__internal/aria/delegate.js';\nimport type { ARIAMixinStrict } from '@/__internal/aria/aria.js';\n\n/**\n * `aria-label` on the host names the progress bar without a visible label (it moves to the inner\n * `role=\"progressbar\"` element, as on buttons).\n */\nexport class BaseProgress extends mixinDelegatesAria(LitElement) {\n /** The current value, clamped into `0`–`max`. */\n @property({ type: Number }) value?: number;\n\n /** The value at which the task is complete. Defaults to `100`. */\n @property({ type: Number }) max = 100;\n\n /** Shows ongoing activity with no known completion, ignoring `value`. */\n @property({ type: Boolean }) indeterminate = false;\n\n /**\n * A visible label describing the progress, which also names the progress bar\n * (`aria-labelledby`). Without one the bar is named \"Loading\" (string `loading`).\n */\n @property({ type: String }) label?: string;\n\n /** Help text shown below the progress indicator. */\n @property({ type: String, attribute: 'helper-text' }) helperText?: string;\n\n /** Lays out the label and the indicator on one line instead of stacking them. */\n @property({ type: Boolean }) inline = false;\n\n /** Peacock's strings, for the fallback accessible name. */\n protected readonly i18n = new I18nController(this);\n\n /** The bar's name without a visible `label`: the host's `aria-label`, else \"Loading\". */\n protected get __fallbackLabel(): string {\n return (this as ARIAMixinStrict).ariaLabel || this.i18n.t('loading');\n }\n\n /** `max`, or 100 when it is not a positive number. */\n protected get __max(): number {\n return Number.isFinite(this.max) && this.max > 0 ? this.max : 100;\n }\n\n /** `value` clamped into `0`–`max`; 0 when unset. */\n protected get __clampedValue(): number {\n const value = Number(this.value);\n if (!Number.isFinite(value)) return 0;\n return Math.min(this.__max, Math.max(0, value));\n }\n\n /** The clamped value as a percentage of `max`. */\n __getPercentageValue(): number {\n return (this.__clampedValue / this.__max) * 100;\n }\n}\n"],"names":["LitElement","property"],"mappings":";;;;;AAMA;;;AAGG;MACU,YAAa,SAAQ,kBAAkB,CAACA,CAAU,CAAC,CAAA;AAAhE,IAAA,WAAA,GAAA;;;QAK8B,IAAA,CAAA,GAAG,GAAG,GAAG;;QAGR,IAAA,CAAA,aAAa,GAAG,KAAK;;QAYrB,IAAA,C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AA,CAAA;AAMvB,UAAA,CAAA;AAA3B,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAiB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGW,UAAA,CAAA;IAArDA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE;AAAsB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAG7C,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;AAAiB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/bottom-sheet.js
CHANGED
|
@@ -4,11 +4,11 @@ import { r } from './state-BCeDVCI9.js';
|
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
5
|
import { e as e$1 } from './class-map-NDIkZErE.js';
|
|
6
6
|
import { o } from './style-map-CHOg6N_R.js';
|
|
7
|
-
import { I as I18nController } from './i18n-controller-
|
|
7
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
8
8
|
import { O as OverlayController } from './overlay-controller-BOk-kfil.js';
|
|
9
9
|
import './base-Cl6v8-BZ.js';
|
|
10
10
|
import './directive-ZPhl09Yt.js';
|
|
11
|
-
import './strings-
|
|
11
|
+
import './strings-DnYjGbbc.js';
|
|
12
12
|
import './locale-DEsJZCQG.js';
|
|
13
13
|
|
|
14
14
|
var css_248z = i`* {
|
package/dist/breadcrumb.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { BreadcrumbItem } from './breadcrumb-item.js';
|
|
4
|
-
import { I as I18nController } from './i18n-controller-
|
|
4
|
+
import { I as I18nController } from './i18n-controller-DJHsE1YH.js';
|
|
5
5
|
import './state-BCeDVCI9.js';
|
|
6
6
|
import './class-map-NDIkZErE.js';
|
|
7
7
|
import './directive-ZPhl09Yt.js';
|
|
8
8
|
import './if-defined-D9DEJR_6.js';
|
|
9
|
-
import './strings-
|
|
9
|
+
import './strings-DnYjGbbc.js';
|
|
10
10
|
import './locale-DEsJZCQG.js';
|
|
11
11
|
|
|
12
12
|
var css_248z = i`* {
|
package/dist/button.js
CHANGED
|
@@ -17,7 +17,7 @@ import './directive-ZPhl09Yt.js';
|
|
|
17
17
|
import './warn-once-BNxX1Y98.js';
|
|
18
18
|
|
|
19
19
|
var css_248z = i`.button {
|
|
20
|
-
transition-property: inset, width, height, transform, opacity;
|
|
20
|
+
transition-property: inset, width, height, transform, opacity, border-start-start-radius, border-start-end-radius, border-end-start-radius, border-end-end-radius;
|
|
21
21
|
transition-duration: 200ms;
|
|
22
22
|
transition-timing-function: var(--easing-standard);
|
|
23
23
|
will-change: inset, transform, opacity;
|
|
@@ -35,7 +35,7 @@ var css_248z = i`.button {
|
|
|
35
35
|
border-end-start-radius: var(--_button-container-shape-end-start, var(--_button-container-shape));
|
|
36
36
|
border-end-end-radius: var(--_button-container-shape-end-end, var(--_button-container-shape));
|
|
37
37
|
corner-shape: var(--_button-container-shape-variant);
|
|
38
|
-
transition-property: inset, width, height, transform, opacity;
|
|
38
|
+
transition-property: inset, width, height, transform, opacity, border-start-start-radius, border-start-end-radius, border-end-start-radius, border-end-end-radius;
|
|
39
39
|
transition-duration: 200ms;
|
|
40
40
|
transition-timing-function: var(--easing-standard);
|
|
41
41
|
will-change: inset, transform, opacity;
|
|
@@ -53,7 +53,7 @@ var css_248z = i`.button {
|
|
|
53
53
|
border-end-start-radius: var(--_button-container-shape-end-start, var(--_button-container-shape));
|
|
54
54
|
border-end-end-radius: var(--_button-container-shape-end-end, var(--_button-container-shape));
|
|
55
55
|
corner-shape: var(--_button-container-shape-variant);
|
|
56
|
-
transition-property: inset, width, height, transform, opacity;
|
|
56
|
+
transition-property: inset, width, height, transform, opacity, border-start-start-radius, border-start-end-radius, border-end-start-radius, border-end-end-radius;
|
|
57
57
|
transition-duration: 200ms;
|
|
58
58
|
transition-timing-function: var(--easing-standard);
|
|
59
59
|
will-change: inset, transform, opacity;
|
|
@@ -157,7 +157,7 @@ var css_248z = i`.button {
|
|
|
157
157
|
border-end-start-radius: var(--_button-container-shape-end-start, var(--_button-container-shape));
|
|
158
158
|
border-end-end-radius: var(--_button-container-shape-end-end, var(--_button-container-shape));
|
|
159
159
|
corner-shape: var(--_button-container-shape-variant);
|
|
160
|
-
transition-property: inset, width, height, transform, opacity;
|
|
160
|
+
transition-property: inset, width, height, transform, opacity, border-start-start-radius, border-start-end-radius, border-end-start-radius, border-end-end-radius;
|
|
161
161
|
transition-duration: 200ms;
|
|
162
162
|
transition-timing-function: var(--easing-standard);
|
|
163
163
|
will-change: inset, transform, opacity;
|
|
@@ -260,7 +260,9 @@ var css_248z = i`.button {
|
|
|
260
260
|
align-items: center;
|
|
261
261
|
justify-content: center;
|
|
262
262
|
height: var(--button-height);
|
|
263
|
-
padding: 0
|
|
263
|
+
padding-block: 0;
|
|
264
|
+
padding-inline-start: var(--button-container-padding-start, var(--button-container-padding, var(--_button-container-padding)));
|
|
265
|
+
padding-inline-end: var(--button-container-padding-end, var(--button-container-padding, var(--_button-container-padding)));
|
|
264
266
|
width: 100%;
|
|
265
267
|
}
|
|
266
268
|
.button .label {
|
|
@@ -918,6 +920,10 @@ var css_248z = i`.button {
|
|
|
918
920
|
* @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.
|
|
919
921
|
* @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.
|
|
920
922
|
*
|
|
923
|
+
* @cssprop --button-container-padding - Inline padding of the button container, on both sides.
|
|
924
|
+
* @cssprop --button-container-padding-start - Inline-start padding of the button container; overrides `--button-container-padding`.
|
|
925
|
+
* @cssprop --button-container-padding-end - Inline-end padding of the button container; overrides `--button-container-padding`.
|
|
926
|
+
*
|
|
921
927
|
*
|
|
922
928
|
* @cssprop --filled-button-container-color - Color of the filled button container.
|
|
923
929
|
* @cssprop --filled-button-label-text-color - Text color of the filled button label.
|